/**
 * @author Frederik Loock
 * DERIVED FROM -> http://code.google.com/intl/de-DE/apis/maps/documentation/services.html#ReverseGeocoding
 * 
 * USAGE:
 * 1. Paste the following tags in your html:
 * <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=THORESGOOGLEKEYHERE" 
            type="text/javascript"></script>
 *
 * 2. Use the functions below in your js code
 */

function getAddress(lat, lon) {
  if (latlng != null) {
    var geocoder = new GClientGeocoder();
    geocoder.getLocations(new GLatLng(lat,lon), showAddress);
  }
}

function showAddress(response) {
  if (!response || response.Status.code != 200) {
    alert("GOOGLE GEOCODER ERROR: "+ "Status Code:" + response.Status.code);
  } else {
    place = response.Placemark[0];
    point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
    
	//Zugriffe...
	
	//bearbeitete (abgeschickte) latlon
	//response.name
	
	 //gefunde (benutzte) lat + lon
	//place.Point.coordinates[0] + place.Point.coordinates[1] 
	
	// Status Code; List here --> URL
	//     response.Status.code
	
	// Status Request; List here -->  
	//     response.Status.request 
	
	// 
	//     place.address 
	
	//     place.AddressDetails.Accuracy 
	//     place.AddressDetails.Country.CountryNameCode);
  }
}


